import { get_time_normal_to_format } from '../../../../../../../../global/Func/get_cur_format_time';
import { file_ext_json } from '../../../../../../../DataDefine/file_info';
import {
  prop_cur_req_time,
  prop_cur_req_user_identity,
  req_cur_headers_info,
} from '../../../../../Classes/cla_req_cur_headers_info';
import { path_file_prefix } from '../../../../../DataDefine/file_path';
import { spacename_user } from '../../../DataDefine/sourceData';

/**
 * path -->
 *
 * D:/class_laugh_files/user/${cur_user_id}
 *
 */
export function get_file_path_prefix_cur_user(cur_info: req_cur_headers_info) {
  return `${path_file_prefix}/${spacename_user}/${cur_info[prop_cur_req_user_identity]}`;
}

/**
 * path -->
 *
 * D:/class_laugh_files/user/${cur_user_id}
 *
 */
export function get_file_path_prefix_cur_user_id(cur_user_id: string) {
  return `${path_file_prefix}/${spacename_user}/${cur_user_id}`;
}

/**
 * path -->
 *
 * D:/class_laugh_files/user/${cur_user_id}/user_${cur_user_id}.json
 *
 */
export function get_file_path_cur_user(cur_info: req_cur_headers_info) {
  return `${get_file_path_prefix_cur_user(cur_info)}/${spacename_user}_${
    cur_info[prop_cur_req_user_identity]
  }.${file_ext_json}`;
}

/**
 * path -->
 *
 * D:/class_laugh_files/user/${cur_user_id}/user_${cur_user_id}.json
 *
 */
export function get_file_path_cur_user_id(cur_user_id: string) {
  return `${get_file_path_prefix_cur_user_id(
    cur_user_id
  )}/${spacename_user}_${cur_user_id}.${file_ext_json}`;
}

/**
 * path -->
 *
 * D:/class_laugh_files/user/${cur_user_id}/user_${cur_user_id}_${cur_file_time}.json
 *
 */
export function get_file_path_cur_user_time(cur_info: req_cur_headers_info) {
  return `${get_file_path_prefix_cur_user(cur_info)}/${spacename_user}_${
    cur_info[prop_cur_req_user_identity]
  }_${get_time_normal_to_format(cur_info[prop_cur_req_time])}.${file_ext_json}`;
}
